#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "sdm660-camera-sensor-qrd.dtsi"
#include "sdm660-external-codec.dtsi"
/ {
};

&blsp2_uart1_hs {
	status = "ok";
};

&uartblsp1dm1 {
	status = "ok";
	pinctrl-names = "default";
	pinctrl-0 = <&uart_console_active>;
};

&sdhc_1 {
	/* device core power supply */
	vdd-supply = <&pm660l_l4>;
	qcom,vdd-voltage-level = <2950000 2950000>;
	qcom,vdd-current-level = <200 570000>;

	/* device communication power supply */
	vdd-io-supply = <&pm660_l8>;
	qcom,vdd-io-always-on;
	qcom,vdd-io-lpm-sup;
	qcom,vdd-io-voltage-level = <1800000 1800000>;
	qcom,vdd-io-current-level = <200 325000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on &sdc1_rclk_on>;
	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off &sdc1_rclk_off>;

	status = "ok";
};

&sdc2_cd_on {
	config {
		/delete-property/ bias-pull-up;
		bias-disable;
	};
};

&sdhc_2 {
	/* device core power supply */
	vdd-supply = <&pm660l_l5>;
	qcom,vdd-voltage-level = <2950000 2950000>;
	qcom,vdd-current-level = <15000 800000>;

	/* device communication power supply */
	vdd-io-supply = <&pm660l_l2>;
	qcom,vdd-io-voltage-level = <1800000 2950000>;
	qcom,vdd-io-current-level = <200 22000>;

	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdc2_cd_on>;
	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>;

	#address-cells = <0>;
	interrupt-parent = <&sdhc_2>;
	interrupts = <0 1 2>;
	#interrupt-cells = <1>;
	interrupt-map-mask = <0xffffffff>;
	interrupt-map = <0 &intc 0 0 125 0
			1 &intc 0 0 221 0
			2 &tlmm 54 0>;
	interrupt-names = "hc_irq", "pwr_irq", "status_irq";
	cd-gpios = <&tlmm 54 0x0>;

	status = "ok";
};

&ufsphy1 {
	vdda-phy-supply = <&pm660l_l1>;
	vdda-pll-supply = <&pm660_l10>;
	vddp-ref-clk-supply = <&pm660_l1>;
	vdda-phy-max-microamp = <51400>;
	vdda-pll-max-microamp = <14200>;
	vddp-ref-clk-max-microamp = <100>;
	vddp-ref-clk-always-on;
	status = "ok";
};

&ufs1 {
	vdd-hba-supply = <&gdsc_ufs>;
	vdd-hba-fixed-regulator;
	vcc-supply = <&pm660l_l4>;
	vccq2-supply = <&pm660_l8>;
	vcc-max-microamp = <500000>;
	vccq2-max-microamp = <600000>;
	status = "ok";
};

&soc {
	qcom,msm-ssc-sensors {
		compatible = "qcom,msm-ssc-sensors";
	};
};

&qusb_phy0 {
	qcom,qusb-phy-init-seq = <0xf8 0x80
				0x83 0x84
				0x83 0x88
				0xc3 0x8c
				0x30 0x08
				0x79 0x0c
				0x21 0x10
				0x14 0x9c
				0x9f 0x1c
				0x00 0x18>;
};

&pm660_gpios {
	/* GPIO 4 (NFC_CLK_REQ) */
	nfc_clk {
		nfc_clk_default: nfc_clk_default {
			pins = "gpio4";
			function = "normal";
			input-enable;
			power-source = <1>;
		};
	};
};

&i2c_6 { /* BLSP1 QUP6 (NFC) */
	status = "okay";
	nq@28 {
		compatible = "qcom,nq-nci";
		reg = <0x28>;
		qcom,nq-irq = <&tlmm 28 0x00>;
		qcom,nq-ven = <&tlmm 29 0x00>;
		qcom,nq-firm = <&tlmm 30 0x00>;
		qcom,nq-clkreq = <&pm660_gpios 4 0x00>;
		qcom,nq-esepwr = <&tlmm 31 0x00>;
		interrupt-parent = <&tlmm>;
		qcom,clk-src = "BBCLK3";
		interrupts = <28 0>;
		interrupt-names = "nfc_irq";
		pinctrl-names = "nfc_active", "nfc_suspend";
		pinctrl-0 = <&nfc_int_active &nfc_enable_active
				&nfc_clk_default>;
		pinctrl-1 = <&nfc_int_suspend &nfc_enable_suspend>;
		clocks = <&clock_rpmcc RPM_SMD_LN_BB_CLK3_PIN>;
		clock-names = "ref_clk";
	};
};

&pm660l_gpios {
	/* GPIO 7 for VOL_UP */
	key_vol_up {
		key_vol_up_default: key_vol_up_default {
			pins = "gpio7";
			function = "normal";
			input-enable;
			bias-pull-up;
		};
	};
};

&tlmm {
	pmx_ts_rst_active {
		ts_rst_active: ts_rst_active {
			mux {
				pins = "gpio66";
				function = "gpio";
			};

			config {
				pins = "gpio66";
				drive-strength = <16>;
				bias-pull-up;
			};
		};
	};

	pmx_ts_rst_suspend {
		ts_rst_suspend: ts_rst_suspend {
			mux {
				pins = "gpio66";
				function = "gpio";
			};

			config {
				pins = "gpio66";
				drive-strength = <2>;
				bias-pull-down;
			};
		};
	};
};

&ssphy {
	fpc-redrive-supply = <&pm660_l11>;
	qcom,redrive-voltage-level = <0 1800000 1950000>;
	qcom,redrive-load = <105000>;
};

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		input-name = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&key_vol_up_default>;
		status = "ok";

		vol_up {
			label = "volume_up";
			gpios = <&pm660l_gpios 7 GPIO_ACTIVE_LOW>;
			linux,input-type = <1>;
			linux,code = <KEY_VOLUMEUP>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};
	};
};

/ {
	qrd_batterydata: qcom,battery-data {
		qcom,batt-id-range-pct = <15>;

		#include "fg-gen3-batterydata-qrd-skuk-4v4-3000mah.dtsi"
	};
};

&pm660_fg {
	qcom,battery-data = <&qrd_batterydata>;
	qcom,fg-jeita-thresholds = <0 5 55 55>;
	qcom,battery-thermal-coefficients = [9d 50 ff];
};

&pm660_haptics {
	qcom,vmax-mv = <1800>;
};

&i2c_2 {
	status = "ok";
	smb1351_charger: smb1351-charger@1d {
		compatible = "qcom,smb1351-charger";
		reg = <0x1d>;
		qcom,parallel-charger;
		qcom,float-voltage-mv = <4400>;
		qcom,recharge-mv = <100>;
		qcom,parallel-en-pin-polarity = <1>;
	};
};

&wcd934x_cdc {
	status = "disabled";
};

&tavil_snd {
	status = "disabled";
};

&clock_audio_lnbb {
	status = "disabled";
};

&clock_audio {
	status = "ok";
};

&clock_audio_native {
	status = "ok";
};

&wcd9335 {
	status = "ok";
};

&tasha_snd {
	status = "ok";
	qcom,model = "sdm660-tasha-skus-snd-card";
	qcom,audio-routing =
		"AIF4 VI", "MCLK",
		"RX_BIAS", "MCLK",
		"MADINPUT", "MCLK",
		"AMIC2", "MIC BIAS2",
		"MIC BIAS2", "Headset Mic",
		"DMIC0", "MIC BIAS1",
		"MIC BIAS1", "Digital Mic0",
		"DMIC3", "MIC BIAS3",
		"MIC BIAS3", "Digital Mic3",
		"DMIC5", "MIC BIAS3",
		"MIC BIAS3", "Digital Mic5",
		"SpkrLeft IN", "SPK1 OUT";
	qcom,msm-mbhc-hphl-swh = <1>;
	qcom,msm-mbhc-gnd-swh = <1>;
	/delete-property/ qcom,us-euro-gpios;
	/delete-property/ qcom,hph-en0-gpio;
	/delete-property/ qcom,hph-en1-gpio;
	qcom,wsa-max-devs = <1>;
	qcom,wsa-devs = <&wsa881x_211>, <&wsa881x_213>;
	qcom,wsa-aux-dev-prefix = "SpkrLeft", "SpkrLeft";
};

